UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TQAh+7PH9pzVwtCFNkZPPXWmkwK8cfrjNsJ2Ts84WM0='
WHERE
key_id = '84e45d83e583c21ab0b3df141ccfcdb7eff264a9e0935a547b830e463cb75d11'
AND (
token = 'TQAh+7PH9pzVwtCFNkZPPXWmkwK8cfrjNsJ2Ts84WM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)