The lock12_5 table is one the Task Persistence tables in the IDM object store. It's used to lock events in progress while the environment is up and running but it does not automatically delete its table entries after events are updated, therefore the table can grow to host millions of rows and cause system slowness or database session locking or other DB errors.
The lock12_5 table also does not get cleaned up by either the cleanup stored procedures or by the Cleanup Submitted Tasks task. The table should be cleaned up regularly by your DBA and should be purged if you are seeing any DB errors, contention, or locked sessions against task12_5.
The lock12_5 table should be purged only while the environment is not running so as not to delete active locks. As long as the environment is not running, there is no possibility of transaction loss or data integrity issues when all rows are deleted.