UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vazlLIgoefuGLxMzFAaKU4A34BaC31YjFv7q7vKFfHY=' 
WHERE 
  key_id = '401c69c533b6aceeafaf8a631346655f291c3d65823aad3f9fcfda273896cd21' 
  AND (
    token = 'vazlLIgoefuGLxMzFAaKU4A34BaC31YjFv7q7vKFfHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037