I have got the following SQL query.
SELECT CASE WHEN start_time > end_time AND (CURTIME() >start_time AND CURTIME() < end_time+24) THEN \'open\'