Thanks, Damyon. I ended up locating and deleting the file and it worked fine after that. The filesystem is just a standard ext4 one.
Does the database locking work OK on MySQL? I was assuming that the fact that Moodle uses DB locking by default for Postgres but not for MySQL meant there was some kind of suboptimal behaviour?