UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9UoHWmRY4QBTVg0f3gODYcZWeinImy5zvjBV7MsTFPI=' 
WHERE 
  key_id = '5881db6d1d9f31a8277d025292c9dbb6030d81e7c1f95bad36fc72d92ab91334' 
  AND (
    token = '9UoHWmRY4QBTVg0f3gODYcZWeinImy5zvjBV7MsTFPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041