UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4awCwM9eVIljU9OQ1wIEJmJwQjPFrD3pIenEyy3wIE=' 
WHERE 
  key_id = 'ea52453d64cc57d711a57a1a79bef266948c7038176bbedeabf8631a77d416ee' 
  AND (
    token = 'V4awCwM9eVIljU9OQ1wIEJmJwQjPFrD3pIenEyy3wIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032