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