UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gi0D93FlPN27DpzfyJz3eeEM4rGBLEmsXbh0RepTW4='
WHERE
key_id = '2c2553444702906a21c914eb660c11c328f344be32116d898aea4f7e6b7b5c3d'
AND (
token = '6gi0D93FlPN27DpzfyJz3eeEM4rGBLEmsXbh0RepTW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)