I dont think its possible to do that, but you can change the value from the server Cloud or on premise in constants tab (will require a restart).
In your case create an entity with an attribute and give it a default value, then allow it to be changed in a microflow or from admin side directly from a page .
Use a constant in a correct way. Before running or deploying you (need to) know and set the constant value. That’s it.
If you want to set a constant in runtime – it sounds like a technical design mistake. It’s wrong. Review your technical design or use an entity or variable which is updateable.
You actually can with the API: https://docs.mendix.com/apidocs-mxsdk/apidocs/deploy-api
See 3.14. But you must also reset the environment afterwards (also possible with the API) to take effect. Not something you want to do on a regular basis :)
So Sufian Othman answer is probably the way to go.