select * from visiting_timings where ( '20:35:34' BETWEEN fromtime AND totime OR ( '20:35:34' > fromtime && nextday = 1) ) and id='2' Tervetuloa Iltreno -->
09:00 02:00