UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nAJfy9tmtBdTnX02fNwl5aWoV8BdwQDDrnLqR0BpsWc=' 
WHERE 
  key_id = '3166c97ed029adf4c33e5f48b7f78b8f1bfc961a10d1342ec91add6d024752ef' 
  AND (
    token = 'nAJfy9tmtBdTnX02fNwl5aWoV8BdwQDDrnLqR0BpsWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024