There's quite a few shortcuts in Thwomp Ruins, knowing which ones to take is crucial to getting the best time. There's some tricks to exploit in each lap, and it's crucial to shave as many seconds as possible in order to dodge the Thwomps in the middle of the track.
The start of the race sets the sequence for the Thwomps: if you don't use the shortcut at the beginning over the grass, the sequence of their stomps will be off for the first two laps, meaning you could get crushed, so make sure you do! On the third lap you'll have to drive on the inside of the Thwomp, there's not a lot of space, but you can make it without falling into the lake.
When you glide, you need to land on the arrows on the ledge in order to keep the gliders all the way to the finish line, shaving another few seconds from your total lap time.
Mario Kart 8 gameplay video walkthrough: Thwomp Ruins fastest time guide