UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O/n+nCMDnzKsmc6XMzQvNR8QTGROWHWr/e0RaYOL4zs='
WHERE
key_id = '8566ff6c0252ec9551d7bba06a5a542f2da666e0491fea0ac6d9352aa33bd6ce'
AND (
token = 'O/n+nCMDnzKsmc6XMzQvNR8QTGROWHWr/e0RaYOL4zs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)