Key metadata can exist without a keyring in the table, so we don't lose it on reinsertion. Also, don't use transactions inside database upgrade tasks. The entire update is wrapped in a transaction, and we don't want to break this!