UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyVvjJD/9+14IexSCIR8ymVTzz29GaAHA/modW6w4bM=' 
WHERE 
  key_id = '7a3bdba4be80aed14bc2d78f89f5a899819721729417db91eda1a7f2609ad3c8' 
  AND (
    token = 'gyVvjJD/9+14IexSCIR8ymVTzz29GaAHA/modW6w4bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020