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