UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hTZtvyt43LfP2BwdU3nQM9VA7mSzdXMem0hKCFl/sgk='
WHERE
key_id = '090e746a49adaf53754881f93f80fa4a61f50863034a5cc6587ec0c89c5bf726'
AND (
token = 'hTZtvyt43LfP2BwdU3nQM9VA7mSzdXMem0hKCFl/sgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)