Hello René,
The button Mark is referring to is meant to reset generation locks for a project version. If I understand you correctly, you are dealing with a synchronization lock. There is no need to execute queries to detect or solve the lock, everything you need can be found on the History tab page in the synchronization screen. Also see our docs: https://docs.thinkwisesoftware.com/docs/sf/synchronization.html#history.
This states:
“If a synchronization aborts unexpectedly the status will remain Active, resulting in a lock. This lock occurs because it is not possible to perform more than one synchronization for a project version at the same time. To reset this lock, the Reset synchronization lock task can be used. The status will then change from Active to Error.”

Hope this helps.