Vehicle Locksmithing requires a Locksmith Kit and is performed by standing on the left (driver) side of a vehicle and holding the Interact Key (Default F/Enter); a grey progress bar will appear on screen and fill up.
Once the locksmithing is complete, the locksmith kit in your hands will be replaced by a key. This key is bound to the vehicle forever and can be used to lock/unlock the vehicle from outside.
A locked vehicle will remain locked over server restarts and there is currently no other way to access a locked vehicle. This will likely change in the future.