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