UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cbq8mBRmt5cgR6Hc9hkWMKDLZY5SgDj85bV7Rtpp09o=' 
WHERE 
  key_id = '8cd48610cc0dee1a35ea2b93c536d36e4f216abc02789670fa4ce96f17aae9f1' 
  AND (
    token = 'Cbq8mBRmt5cgR6Hc9hkWMKDLZY5SgDj85bV7Rtpp09o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029