You left out the important bit
"However, sex with a minor under age 18 is a compoundable offense, regardless of consent."
That means it is illegal for a 40yo which the OP is talking about. You gave terrible advice.
It really is simple to understand
1 to 14 illegal for everyone
15 to 17 legal for 15 to 17 only
18+ legal for 18+ only
That's what all the websites say and what Thai law says.