sdk: lock only on cache absence

check if cache not available and only then lock,
using double check will save unnecessary locking of
context map

Signed-off-by: Michael Pasternak <mishka8520@yahoo.com>