UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+KSaqf4lnADRIzVKHicODok8JBUdFSFvPe6S84IG9o=' 
WHERE 
  key_id = 'a67f5297019505926700060c9ac7136a8a0e25ff18ae1107bff38455bdadcb8b' 
  AND (
    token = 'n+KSaqf4lnADRIzVKHicODok8JBUdFSFvPe6S84IG9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029