UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QHgYTjGHgdmrttHSStypU6wJaCW0kvqiV3ivMh7EA/w='
WHERE
key_id = 'eaa92fc6af3b11d3da55ba5444a8378764a3697b683cf143c9df0bac86cdeaed'
AND (
token = 'QHgYTjGHgdmrttHSStypU6wJaCW0kvqiV3ivMh7EA/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)