If the flight is just two hours delayed the chances are quite high that they catch up on timing until you reach CPH. There are only 3 to 4 flights CPH-HAM a day anyway, so I would just wait until you’re in CPH. Then go to the SAS lounge directly after passport control if you indeed miss your connection.
BTw HAM flights usually leave at C bus gates which are like 5 minutes walk tops from passport control. So, if in doubt you could catch the flight, make a run for it.