Created replaceTriplet method to have ability to use transactions in storage.
Merge pull request #5 from bartosz-maciaszek/master

Fix Data inconsistency problems

Replacing the old token with the new is now guarded against race conditions, especially when using a DB storage.