To add to Chris' answer, I'd say eat them after doing the usual look-, smell- and taste-checks. Above all, make sure the can hasn't been deeply dented, is rusty or is bulging; in those cases, don't even taste-test it: the severity of botulism (or any other illness originating from bacteria in preserved food) is just too serious to take the risk (and, talking about sustainability: imagine the environmental cost of treating serious infections and their consequences that need several days, if not weeks, of hospitalisation).
If you do not eat them, composting those will be completely fine, but you might want to remove the excess liquid first if your compost heap is humid enough already. Some processed/cooked/rotten/mouldy food is fine in composts, especially if they represent a small part of it. The most important thing is to make sure that your compost has the right C:N ratio, the right aeration and the right humidity.
Make sure you recycle the cans. You can also "upcycle" them by poking a few holes in them and using them as plant pots, which might contain some of that compost at some stage...