You can use JSONata for that. Oddly, just what I've been doing today:
This changes the topic from something like homie/<devicename>/sensors/temperature to be a friendly name looked up from a global variable (that is now persisted to the file system! Way to go Nick). The output is a simple string. Not all JSONata output has to be JSON.
Personally I'd look at the Template node rather than the Change node. Whilst JSOnata does let you do that sort of thing, if you don't need to do any processing beyond just inserting the message properties at the required points, the Template is possibly easier.
To provide a rather simpler example, to do what you want you can use a Change node configured to Set msg.payload to JSONata expression (thats J: in the dropdown, not JSON) "UPDATE openhab.vars SET STATE=" & payload & " WHERE idVARS='3';"
[{"id":"5b69b1f6.84959","type":"inject","z":"3a44a2d3.e9a7ae","name":"","topic":"","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":676.0195827484131,"y":715.0039119720459,"wires":[["160308e3.440b57","b84aa268.6b03d"]]},{"id":"b84aa268.6b03d","type":"change","z":"3a44a2d3.e9a7ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"UPDATE openhab.vars SET STATE=" & payload & " WHERE idVARS='3';","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":930.8828125,"y":711.13671875,"wires":[["ed1429be.299688"]]}]
Please edit your post and put ``` (three.back tick characters) ona new line before and after your flow JSON. That will prevent the forum from mangling some of its contents. As it currently stands, we cannot import it to have a look
You have missed off the quotes round the text strings. You need to enter the text as I previously posted, including the quotes "UPDATE openhab.vars SET STATE=" & payload & " WHERE idVARS='3';"