UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JWfiKocPCQNHuHQd0pICLNS/tDjqLg4IwJatkQwWaxI=' 
WHERE 
  key_id = '8096b52003c26eaa00d9959a003c29f130dac8ee8e3446e288568fe334b5fb1f' 
  AND (
    token = 'JWfiKocPCQNHuHQd0pICLNS/tDjqLg4IwJatkQwWaxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036