This post will detail a quick work-around for locked files in Nextcloud and Owncloud.
If you find that you cannot delete a specific file in Nextcloud or Owncloud due to it being locked; you can use the following MySQL statements to unlock the file and regain write access.
SELECT * FROM oc_file_locks oc WHERE oc.`lock`=1; #First list all files that are lock
DELETE FROM oc_file_locks WHERE `lock`=1; #If you are happy with the output of the first command you can run this one to remove the write lock
Always take a backup of your database before performing manual operations which could compromise the integrity of the database.