UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9cPuaV22T5Z19toC7ewUlhfPlPjPkE7qvQd+HGRwh5A='
WHERE
key_id = 'ef07d9fbd7c29053138fad6dfa53d52f44340952eda2266a6200ceda48ae030b'
AND (
token = '9cPuaV22T5Z19toC7ewUlhfPlPjPkE7qvQd+HGRwh5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)