Somethign like
$current_time = //current time of day since 12am
//start_time would be seconds since 12am
//length would be in seconds
$query = 'select * from classes left join class_time on classes.class_id = class_time.class_id where start_time > "'.$current_time.'" and (start_time+length)< '".$current_time.'" order by start_time asc';