UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UEjuIvuo6PolMo2o5j0WK6M4gsyV7sNCd7B3QD++UbQ=' 
WHERE 
  key_id = '4f38ce3f833f86e456fa2e1b2ab0273f95bf88e33bdab1424a8a6c26ba988c5b' 
  AND (
    token = 'UEjuIvuo6PolMo2o5j0WK6M4gsyV7sNCd7B3QD++UbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035