The Lock pins physically prevent the side brace/drag brace from moving. The side/drag brace forms a geometric lock that prevents the gear collapsing even without hydraulic pressure applied. The A320 uses sleeves around the down lock actuator that prevents the side stay from moving.
When the gear is selected 'up' on the ground, hydraulic pressure is still applied to the actuators but they are prevented from moving by the pins and/or sleeves.