I found an error when I tried to delete a folder in Nextcloud that said that it wasn't possible to delete the folder because it was locked.

In the Nextcloud Help webpage I found 3 ways to resolve the problem. I tried 2 of them:

Use the occ command to scan and repair the file system

I ran the command in Docker:

podman exec --user www-data nextcloud_app php occ files:scan --all

But this solution didn't work for me.

Empty the file locks table in Nextcloud database

I opened a shell in the database container:

podman exec -it nextcloud_db bash

And then opened a MySQL terminal:

mysql -u <user> -p<password>

And I removed all the rows from the oc_file_locks table:

-- Show databases and select the nextcloud one
show databases;
use nextcloud;
-- Check how many elements are in the table
SELECT COUNT(*) FROM oc_file_locks;
-- Remove all of them
TRUNCATE TABLE oc_file_locks;

And with this I solved the problem.