UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9vkZAKerDUXzuhM3Qj0MVW1lPeENJB3qsEWMbgEkZuQ=' 
WHERE 
  key_id = '861e68892c0e3bd380a4aae73eb9b1665868ee532998169f431f7ff248c1b379' 
  AND (
    token = '9vkZAKerDUXzuhM3Qj0MVW1lPeENJB3qsEWMbgEkZuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042