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