Don't save cart to database when nothing has changed

Calculate a cart signature when a cart is loaded from the database
Recalculate the signature when a cart is being saved, compare the signatures, don't save if they are not different.
Let's use json_encode instead of serialize.