Here is a list of processors supported by your motherboard:
https://www.asrock.com/MB/Intel/H310M-HDV/#CPU
I5-9400 would be a modest upgrade.
Mostly from getting 2 additional processing threads.
Most games depend on the single thread speed of the processor.
Run the cpu-Z bench test and look at the single thread score.
On your i3-8100 you should get something like 422.
Here is a list of other results.
The i5-12400 will be at 700 or so:
http://valid.x86.fr/bench/0gt9vb/1
If you go the i5-12400 upgrade route, you should be ok for most any games.
Here is a review:
https://www.tomshardware.com/news/intel-core-i5-12400-review
You can reuse 2 sticks of your DDR4 ram.
Consider your choice to buy the cheapest.
How important is $20 to your budget?
For example, buying the 12400 instead of the 12400F will allow you to use integrated graphics.
A good insurance if anything should go wrong with your graphics card.
Or, $20 will buy you a B660 based motherboard.
The H610 motherboard will work.
Here is a chart as to what different chipsets do:
https://en.wikipedia.org/wiki/LGA_1700
Most improvements past the base h610 are not really relevant.