Update the query used to delete invalid items in storage