UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DoBooW+2qJa7dnlywlLsDh/2D1SrbwLtlmfpYI+lb0=' 
WHERE 
  key_id = '107d39318a0e52bd3775919a088db0ad50644ec62eb07294be0687e70b6fcd3a' 
  AND (
    token = '6DoBooW+2qJa7dnlywlLsDh/2D1SrbwLtlmfpYI+lb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037