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