Currently, if you pin an ability, it always stays pinned. Even if you dropped the item (if it is granted for an item or by item itself), disembarked (if it is a vehicle ability) or removed psi slot, etc. it just changes color to red and automatically becomes active when applicable.
But this does not work with consumables, batteries, ammo, certain plot items etc. that can run out, get removed from your inventory when used or moved to crafting window, and this does not work even if you lock the action bar buttons.
For example, if you assigned a fusion cell to recharge item and object, next time you run out of them or place it in crafting window, you'll need to reassign actions again.