UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LtyP/G5maMuGgIyVEMP7jNdr6exy3h2e1cCO4jgfOIw=' 
WHERE 
  key_id = 'a0549809b4cc96cee96a89c9a411c8d9ae36fd96621b9c1dde0cfe4c8100f4bc' 
  AND (
    token = 'LtyP/G5maMuGgIyVEMP7jNdr6exy3h2e1cCO4jgfOIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032