Here is sample pseudocode to capture the logic.
Attached is the sql export.
if ( lab_sessiontime .Start_time > NOW())
then lab is free for Start_time - NOW() minutes
_______________ _______________ _______________ _______________ ____
else if (lab_sessiontim e.Start_time < NOW() )
then check if ( NOW() > lab_sessiotime. End_time
if true then lab has been free for [NOW() - End_time]...