UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P8+qoyMlx/KeEClw55q50A2iE11Ra4rbxnBIr+TKORo=' 
WHERE 
  key_id = '91db2e1d8dfad04c2aa1300a53e33d2fbdbecbe1ec60b4ce0797ada2bed35b30' 
  AND (
    token = 'P8+qoyMlx/KeEClw55q50A2iE11Ra4rbxnBIr+TKORo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049