Discussion here: https://forum.pkp.sfu.ca/t/ojs-upgrade-from-3-0-2-to-3-1-0-1-stuck-on-slow-query/36706
The single sql query used to update the assoc_id's of assoc_type 531 is extremely slow in larger metric tables. For example a 900 megabyte metrics table takes around 34 hours to run the given query.
The query should be broken into smaller parts using an upgrade function. Pull request soon.