You can do this using modulo operator. These three values you know:
DECLARE @OffsetClasses INT = 5
DECLARE @CurrentID INT = 7
DECLARE @ClassesCount INT = 10
Then it's trivial to get the current sort order:
DECLARE @CurrentSortOrder INT
select @CurrentSortOrder = SortOrder from Classes where ClassID = @CurrentID
Assuming your sort order is a raising sequence from 1 to 10 with no gaps then next row can be retrieved like this:
select * from Classes
where SortOrder = (@CurrentSortOrder + @OffsetClasses - 1) % @ClassesCount + 1