You can use a kitchen timer and explain to him that when the timer rings after 20 minutes he can get up. Set the time every time a new lesson starts. This will help him and others in the class. After each session give him and others a 5 minutes stretch time. This will keep him focused as children do need to move. This method can be used at home as well and reward for completion of task in 20 - 30 minutes is being able to watch TV, play games etc.
Hope you find this helpful.