You can buy into AppleCare anytime before the original warranty expires. Has nothing to do with whatever 3rd party buy and sell site you got the thing from.
That is the only correct answer. It cannot be purchased at any time.
And as far as I know regular applecare is not sold any more and its discontinued. Only applecare sold for iphone is applecare plus.
You can purchase applecare plus only within 60 days of the original purchase. So if someone got a 6 month old iphone and just replaced it via warranty you cannot add applecare plus to it even though the replacement its only a few days old for example.