Consequences of under-tight cassette ring? I have a torque wrench that goes up to 24 N⋅m but as far as I understand a cassette ring should be tightened to about 40 N⋅m. What is the consequence of tightening the cassette ring to 24 N⋅m instead of 40 N⋅m? Will it damage the bicycle or make the bicycle unsafe?
Assuming your cassette and freehub body are conventional, the cassette sits on a series of splines, and would be free to slide left/right if there were no locknut in the way.
Since the hole in the cassette will be larger than the diameter of the freehub body, a missing or loose lockring will allow the cassette to twist out of the vertical plane parallel with the rim.  Effectively this will vary the horizontal position of the teeth over each wheel rotation, more noticeably on the bigger cogs.
However as long as the lockring is done up sufficiently to not back itself out and also tight enough to stop the cassette moving relative to the freehub body, you'll be fine.

I've serviced bikes where the lockring has needed a cheater bar to undo, and others where the lockring was not even finger-tight.   These latter ones tended to have poor shifting and/or damage to the freehub body's splines.  Since finger-tight is under 3 Nm  ( okay 0.1~0.3 Nm or 1.7~2.6 Nm depending on what study you're comparing)  then 24 Nm from your torque wrench plus a yank more with a spanner should be close enough.
In full disclosure, I've never used a torque wrench when securing a cassette lockring (new or reused) and I've never had one come off or fail.  You develop a feel for a pressure that is tight enough for this application.

https://www.ors.org/Transactions/59/PS2--085/1535.html tests .1 to .3 Nm
https://en.wiktionary.org/wiki/finger_tight says 1.7~2.6 Nm