Rigid body animation with constraints and relationships
It sounds like Rigid body constraints are what you want.

For a padlock you most likely want a Hinge constraint, to allow rotation on only one axis.

Creating a Rigid Body constraint

3D view > Tool Shelf > Rigid body tools:



This is the easiest way (currently) to create RB constraints. (Select objects and press Connect. all selected objects have to be Rigid Body objects to do this.) This will create an empty that represents the constraint. (Constraint settings are in the physics panel)



A quick setup,
frame 1 and frame 50:



Note that the orientation of the empty refers to the orientation of the "hinge" (what direction it's allowed to rotate in.) by default the hinge will be allowed to rotate around the local Z axis of the empty.

Result: