UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jHZByK9BiknizbTooJhW0LbuIp1P4wg8E2YeVAEBUJk='
WHERE
key_id = '2e8ce96c2ef3e0f1fbc81bc5833bb594be46f7cf3ab01254235c0daff110112f'
AND (
token = 'jHZByK9BiknizbTooJhW0LbuIp1P4wg8E2YeVAEBUJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)