UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4g+vemWjE035mdTlQWD6s9eUAS0x1Iz5eraKqiuycG0=' 
WHERE 
  key_id = 'dd197831db90f354a0e6f20dd3c589cd033f1b03723738eed84021fa93d08218' 
  AND (
    token = '4g+vemWjE035mdTlQWD6s9eUAS0x1Iz5eraKqiuycG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044