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

Query time 0.00026