Thanks for your fast and sorry for my late response (too much to do and too little time).
Your sugestion and this one https://moodle.org/mod/forum/discuss.php?d=273400 helped us to find a solution.
Thanks for your fast and sorry for my late response (too much to do and too little time).
Your sugestion and this one https://moodle.org/mod/forum/discuss.php?d=273400 helped us to find a solution.
After trying all the offered solutions (increasing max_allowed_packet, adding $CFG->dbsessions='false', and updating all tables to Barracuda) The solution was found by going through the course's units and deleting them one by one until we could perform a backup, and we found the problematic content (probably was corrupted).
Not the fastest solution but the best in lack of a better one.