These are the minimum requirements to reset the ScreenTime passcode:
- The device must run iOS/iPadOS 13.4 or later;
AND
- You must know the Apple ID & Password that were used to set up that ScreenTime Passcode.
If you meet both above requirements, these are the instructions:--> If you forgot your Screen Time passcode – Apple Support
Shouldn't be this case (you stated you can't update your old iPad beyond 12.5.4. version), you need to erase that device following these instructions (even if related to the passcode to lock/unlock device's screen):--> If you forgot the passcode on your iPhone, or your iPhone is disabled - Apple Support
The bad news is that you cannot restore data from a backup, since the ScreenTime passcode would come back in.
Regards
Giulio