UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q5aFsk3nc5YD1pmmGPzBK1dDaUO3jS3bpueUFKSHmEU='
WHERE
key_id = 'ae2195ec36e481ffac173db23d6198d822d59a9d43debf32ecb5da02ac20395f'
AND (
token = 'Q5aFsk3nc5YD1pmmGPzBK1dDaUO3jS3bpueUFKSHmEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)