If you study in the library or a coffee shop, try to recreate that space. This can help with focusing on your course work. You can trick your brain into associating a place or activity with being productive.
If you are anxious or distracted try to focus on a task for 15 minutes. Tell yourself that you will think about any distractions in 15 minutes, after you finish the task.