UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y5axROGP+sACnhBbW4zD82vWt8P0WQ+bzur5HtU8U9E='
WHERE
key_id = '5a6754dae2030e1f6d672b404d7e361117a366697f24fbfcc9493c9352e9aa9f'
AND (
token = 'Y5axROGP+sACnhBbW4zD82vWt8P0WQ+bzur5HtU8U9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)