Store is_locked status in SQL.

Change-Id: I8014b269f900596bfa51f13bdb9f4bd29bad8803