Uzma,
I think you are confusing the Owner ID and the lockcookie into one issue, when in fact they are 2 seperate functions. The Owner ID is a user defined number that will be assigned during a Book action. All you will need to do is write this number to a file record. Once booked, there is (at least in my requirements) no need to unbook.
The lockcookie is used to lock database records before update/deletes can be performed. So the sequence should be lock - update - unlock. In order to obtain the lock, the record must be unlocked ( and in my assumptions - not deleted).
I return the lockcookie ( long ) creating a random number as follows:
Then when the update or unlock is called, the passed in lockcookie must match the one I have stored in memory for that record.
Hope that helps.