Is it possible to change the server_id in a stick table with lua?

I use stick tables in my setup because I want to have connection persistence for a runtime. This works perfect.
The next iteration of my project will include replication of state in my runtimes. This means that state for a particular user is only available on specific servers. So the stick table needs to stick to the right server.
My idea was that I could have a lua script that checks if there is an entry present in the stick table (for the user i) and the server is up or it makes a http request to a backend server to get the right server for the requesting id. It would then create or update the stick table with the proper server_id.

I‘ve seen only a couple of usages with lua treating stick tables but none that is actually setting something in it. IIRC it is possible with using the socat interface.

So is it possible to modify a stick table with lua?