We've been storing it in the invoice_id field of the contribution_recur table, which has a unique constraint on it.
Unfortunately, some tokens used for multiple active Ingenico recurring contributions have been mapped on the Adyen side to a single ShopperReference.
Ideally the ShopperReference would uniquely identify a single donor, but since we don't have accounts, we need to be able to have different ShopperReference values for each recurring contribution. We also need to be able to re-use the same ShopperReference value for multiple recurring contributions, which we can't do while we store it in a field with a unique constraint.
Add a new field to contribution_recur_smashpig, copy existing values from contribution_recur.invoice_id, and update code to store and read from the new field.