well the question is how do you want the cart to behave ? should it be local? or account bound? as soon as you go for an account in combination with a cart there is only 1 solution that works cross browser.
So I personally would go for the Database you can however store a cart without an account via a specific ID and this id can be stored in the localStorage so the use can reopen it on the browser
every cart that has not been opened for a certain amount of time can be deleted. But maybe someone can argue for a different approach like the Session since you see the user as 'shopping right now' and you don't care about the past or a later.
it depends how you want the user to experience your shop