UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rQN5Oq9oiZ0eKylQ4FeF9GIscjLo3rGiH95zRXUOv7M=' 
WHERE 
  key_id = '1e94f5c6b275ac32a8a68e9a0bf42de03d52b87ff2fd02d5da97ed4357067d57' 
  AND (
    token = 'rQN5Oq9oiZ0eKylQ4FeF9GIscjLo3rGiH95zRXUOv7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028