UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oXjEj3GBjosOzH7GVb/CSvA3+uUIdDpGjj6xvCK7PYE=' 
WHERE 
  key_id = '2ff0f25bd5df05fe8706e4f879f2eb42671eb6b36b081b61074da071371cc2d6' 
  AND (
    token = 'oXjEj3GBjosOzH7GVb/CSvA3+uUIdDpGjj6xvCK7PYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042