When you’re on the moving pathway you’ve got to keep walking or you’ll end up in the lava. The path keeps branching so be careful not to get stranded at a dead-end. But there’s a green switch at one of the dead-ends and you have to step on that to unlock the exit.
Oh, and the boss is attacking you while all this is going on.