Introduce lock api for instances

To allow coordination for tasks liek rescheduling of instnaces
this change adds the API to aquire a lock for an instance and
release it.
Merge pull request #102 from soundcloud/feature/lock-instances

Introduce lock api for instances