You are using a HashMap to store locks. HashMap is not thread safe, so you need to exclusive access, when inserting locks in your lock handler. From what I can see, it looks like to threads can lock different records, and thereby modify the HashMap simultanously.
Regarding deadlocks(when two threads a is mutually waiting on each other), asuming that each client holds at most one lock, which imo is a fair asumption based on the usecases.
You should be able to implement your server without the risk of deadlocks.
Stale locks might be a problem depending on the design of your client-server communication. If your client has to first call lock, then update and finally unlock on the server. You have to implement some strategy for dealing with stale locks (when clients 'die' while holding a lock).