you can determine whether a toon knows a spell by calling GetSpellLink() with the name of the spell (has to be the name, not the id). if it returns nil, then the spell is not known.
as for casting on the next keypress, yes and no. you can create a secure frame to cast a spell and have that secure frame bound to a key, but you can only modify secure frames outside of combat. so if the goal is to create some kind of smart combat system that self modifies, you're out of luck.
You seem to be confused as to what the reset condition of castsequence actually does. Like most people you seem to think you can use it to get your debuffs to be cast again when they expire. It doesn't work that way, give up now you'll never get anything that works that way.