Yes you can restore.
If you unlocked and restore to the same firmware you will stay unlocked.
You will have to jailbreak/activate again though.
Do NOT restore from a backup when jailbreaking as it will cause issues that will only be resolved from restoring again to clean!