Run an update query in a function

As David pointed out, wpdb::query() does not allow multiple calls.
So yes, it is because of having the "SET @newnum = 0;" before your actual query.
This kind of query is simply not possible as the backend prevents that in order to protect against SQL injection attacks.

Besides of that, the technique I described in my blog serves a different use case which seems unrelated to what you want to achieve here.

May be you should be more exact on what you want you want your “SET” clause to do?

[...] SET tix.TKT_order = @newnum:=@newnum + 1";

What should be the expected outcome on the query?