A product that we used to use had a table that maintained when locks were placed. In their system, primary keys were always a single integer. So, the table was fairly simple: session identifier(s), table name, row key. When a person went into a record, a procedure was run that would attempt to insert the lock. If the row already existed, that person would only get view. Otherwise, a row was added to the lock table, granting the session permission to edit. Once the record was exited, the row was removed from the lock table.
If the application was closed without using the proper exit mechanism (they had to click on sign out on the screen), we would get records that were locked out. We wrote a method to clear out these lock rows. We asked the original developers to clear out everything for a session on application termination but weren't able to get it added.
I would try to put an expiration time in a lock table so that it can get cleared out as needed. While you can't guarantee an application will always exit cleanly, try to include something to clear out all edit locks for a normal application exit.