UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KnN6I4EjIs8vH9ZpJgxrFxI5rxIiz3ntblEHqZhNxWg=' 
WHERE 
  key_id = 'f9d5318c9fd9c37115052888769a63f8dff93fb68f3399602223fef596529e54' 
  AND (
    token = 'KnN6I4EjIs8vH9ZpJgxrFxI5rxIiz3ntblEHqZhNxWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038