UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yvn+VKwSg1whkiXyoa2Gf8VQD89zQvUWFSsVG7AfBrw=' 
WHERE 
  key_id = '00a4657d690f646261db4b5f2bdae325b8345fe0923259073fbfbcaf95ac27d0' 
  AND (
    token = 'yvn+VKwSg1whkiXyoa2Gf8VQD89zQvUWFSsVG7AfBrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027