UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AOoZ7r0PiE62lMcP96ELgBltNcTBocqm0JOur/6kxDk=' 
WHERE 
  key_id = 'fecc5e3e9a07d73212fb2fed9bceafd96d5997fb63777ab6476202e830753248' 
  AND (
    token = 'AOoZ7r0PiE62lMcP96ELgBltNcTBocqm0JOur/6kxDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030