UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GfvJVwrpxaF/0pE85M09yHlWmYV2lNMOASJ0Z92oRrk='
WHERE
key_id = 'ba265f6c743b6bc669b50e1dd9b6fc21ed7e860bc50e6af5400d838ad852e3aa'
AND (
token = 'GfvJVwrpxaF/0pE85M09yHlWmYV2lNMOASJ0Z92oRrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)