UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BVr+oZtXNwiW65W3/rMfSC11KXJ5w4a9QM+/t/KK0+g=' 
WHERE 
  key_id = '1f025851639ee3f5f57d8adf2487296a97d14ed4e833d4ffe8af6df685cbd8cc' 
  AND (
    token = 'BVr+oZtXNwiW65W3/rMfSC11KXJ5w4a9QM+/t/KK0+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046