UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YC3AV0QheCHOomFZ6+XiWmDGXWmC0w/ltxwYdSH84FY='
WHERE
key_id = 'c84cff544072daad3984b2affd84da3c6d37a0e868c9c187c403fbff50ae902a'
AND (
token = 'YC3AV0QheCHOomFZ6+XiWmDGXWmC0w/ltxwYdSH84FY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)