UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cFwZ8LmbfjnvGbcNYZL7o51G9PZEc7OwimYVRu+58PY=' 
WHERE 
  key_id = 'f377c63997314fa03c966fae69cfb9f14f0732cf9960d2f2b9925a842cf5652f' 
  AND (
    token = 'cFwZ8LmbfjnvGbcNYZL7o51G9PZEc7OwimYVRu+58PY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027