SELECT `id`
FROM `table`
WHERE CURTIME() BETWEEN `start_time` AND `finish_time`
AND `next_time` < $current_time;
UPDATE `table` SET `next_time` = `next_time` + `interval`*60
WHERE `id` IN ({$task_list});
UPDATE `table` SET `next_time` = `start_time`
WHERE `next_time` > `finish_time`;