Locks are not synchronized between multiple BaseX instances. We generally recommend working with the client/server architecture if concurrent write operations are to be performed.
As XQuery is a very powerful language, deciding which databases will be accessed by a query is non-trivial. Optimization is work in progress. Databases locked by a query are listed in the GUI's [[GUI#Visualizations|Info View]] and on the command line client if [[Options#QUERYINFO|QUERYINFO]] is set. If you think too much is locked, please give us a note on our [http://basex.org/open-source/ mailing list] with some example code.