I only have a second so you'll have to forgive me for the lack of detail;
But you could use triggers to track whether or not the player is in the room, (OnTriggerEnter - They are inside the room, OnTriggerLeave - They have left the room) then once the 24 hours is up, have a script check every few seconds if the player is in the room or not, and once they are not the door is locked.
Alternatively you could use http://www.creationkit.com/GetParentCell_-_ObjectReference to check if the player is in the cell, then lock the door if they are not.